home *** CD-ROM | disk | FTP | other *** search
- //
- // OldEvent.h
- // Copyright (c) 1989, 1990 by Jiro Nakamura
- // All rights reserved
- //
- // Interface definition of class Event. Event handles the database management
- // of Cassandra.
- // This is for convert. Using Event.h v1.7, modified 90/01/08
- //
- // RCS Information
- // Revision Number-> $Revision: 1.7 $
- // Last Revised-> $Date: 90/01/08 02:51:11 $
- //
-
- #import <objc/Object.h>
- #import <time.h>
- #import "cass.h"
-
-
- @interface OldEvent : Object
- {
- EFileLink present, previous, next; // links to previous and next records and itself
- // See documentation for queue implementation
- // details
- struct tm ts; // time structure see ctime(3) for details
- int priority, // Priority of message (when it gets viewed)
- destroy, // Destroy after message? 0= never destroy
- // 1 = destroy immediately after, 2...n = destroy after n calls
- anniversary, // Anniversary event, 0 = no anniversary
- // (int) (anniversary / 100) is the "base interval":
- // 1 = daily
- // 2 = weekly
- // 3 = monthly
- // 4 = yearly
- // anniversary % 100 is the number of "base interval" that
- // make up the "true interval" between anniversary events
- sleepNo, // No of sleep times allowed
- sleepInt; // The sleep intervals themselves (in minutes)
- char alarmSound[128]; /* The alarm sound name */
- char msg[MESSAGE_SIZE]; /* message buffer */
-
- id global;
- char eventFile[128];
- }
- // Constructor: newAt: (const char *) eFile;
- // Description: Constructs new object instance of Event, with the Event
- // reading the file <eFile>
- +newAt: (const char *) eFile;
-
- /* low level routines dealing with event links themselves */
-
- // Method: readEvent : (EFileLink) here
- // Arguments: (EFileLink) here -> the EFileLink in the queue to read from
- // Description: Reads the event directly from the queue with <here> as the
- // index.
- // Return Value: <self>
- - readEvent : (EFileLink) here;
-
-
- // Method: writeEvent : (EFileLink) here
- // Arguments: (EFileLink) here -> the EFileLink in the queue to write to
- // Description: Writes the event directly into the queue with <here> as the
- // index. Note that this is not an insert, so the next and previous
- // pointers from the last read from this event should be preserved
- // or new pointers should be made and changed appopriately.
- // Return Value: <self>
- - writeEvent : (EFileLink) here; /* write itself into the event file */
-
-
-
- /* Higher level methods that deal somewhat abstractly with the queue */
-
- // Method: firstEvent
- // Arguments: None.
- // Description: reads the first event. Equivalent to:
- // [ev readEvent:0];
- // [ev readEvent: [ev next]];
- // Return Value: returns with the first event read into its internals
- - firstEvent;
-
-
- // Method: (EFileLink) insertEvent
- // Arguments: None, event to be inserted must be already in object
- // Description: Inserts itself into the queue. It is sufficiently intelligent
- // enough to convert all mistaken dates and times into the
- // proper format before inserting itself, so that other
- // modules that use it can simply add blindly to dates.
- // insertEvent is equivalent to insertEventFrom: 1
- // Return Value: The particular EFileLink that it inserted itself into.
- - (EFileLink) insertEvent;
-
-
- // Method: (EFileLink) insertEventFrom: (EFileLink) here
- // Arguments: (EFileLink) here -> start inserting from <here>
- // Description: Same as insertEvent except that the search for empty events
- // starts from <here>, so that if you KNOW where an deleted
- // EFileLink is, then you can use this method to speed things up
- // somewhat.
- // ReturnValue: The particular EFileLink that it inserted itself into.
- - (EFileLink) insertEventFrom: (EFileLink) here;
-
-
- // Method: deleteEvent: (EFileLink) here
- // Arguments: (EFileLink) here -> the event to delete
- // Description: Delete the event <here>
- // Return Value: <self>
- - deleteEvent : (EFileLink) here;
-
-
- // Method: int murderEvent : (EFileLink) here
- // Arguments: (EFileLink) here -> the event to "murder"
- // Description: "Murdering" an event deletes an event, but if it is an anniversary
- // event, then it reinstalls it appropriately in the future. See above
- // for description of state variables for "anniversary" events.
- // Return Value: The EFileLink where the new event lies. -1 if it was not
- // reinserted
- - (int) murderEvent : (EFileLink) here;
-
- /* Accessors */
- /* See heading above for description of these variables */
- - (EFileLink) present;
- - (EFileLink) previous;
- - (EFileLink) next;
- - (int) destroy;
- - (int) priority;
- - (int) anniversary;
- - (int) sleepNo;
- - (int) sleepInt;
- - (char *) alarmSound;
- - (char *) message;
- - (struct tm *) time;
- - (int) mday; // These access the time structure directly, instead of
- - (int) mon; // using the structure accessors
- - (int) year;
- - (int) hour;
- - (int) min;
- - (int) sec;
- - (int) wday;
- - (int) yday;
-
- - setPresent : (EFileLink) apresent;
- - setPrevious : (EFileLink) aprevious;
- - setNext : (EFileLink) anext;
- - setDestroy : (int) dst;
- - setPriority : (int) si;
- - setAnniversary : (int) anv;
- - setSleepNo : (int) sn;
- - setSleepInt : (int) si;
- - setAlarmSound : (char *) alarmSound;
- - setMessage : (char *) message;
- - setTime : (struct tm *) time;
- - setMday : (int) x;
- - setMon: (int) x;
- - setYear: (int) x;
- - setHour: (int) x;
- - setMin: (int) x;
- - setSec: (int) x;
- - setWday: (int) x;
- - setYday:(int) x;
- @end
-
-
-